package botcraft.game;

import java.util.Set;

import botcraft.game.unit.Unit;

public class Player {
	private final String name;
	private final Set<Unit> units;
	
	public Player(final String name, final Set<Unit> units) {
		if (name == null)
			throw new IllegalArgumentException("Player name can not be null");
		if (units == null)
			throw new IllegalArgumentException("Player units can not be null");
		this.name = name;
		this.units = units;
	}
	
	public String getName() {
		return name;
	}
	
	public Set<Unit> getUnits() {
		return units;
	}
		
	@Override
	public boolean equals(final java.lang.Object object) {
		return (object instanceof Player) && name.equals(((Player) object).name);
	}
	
	@Override
	public int hashCode() {
		return name.hashCode();
	}
	
	@Override
	public String toString() {
		return name;
	}
}
